home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 September / Ahoy_Magazine_86-09_1986_Double_L.d64 / compact pix.txt < prev    next >
Text File  |  2022-10-26  |  2KB  |  59 lines

  1. PICTURE COMPRESSION SYSTEM
  2.  
  3. by  Colin Thompson
  4. and David Stidolph
  5.  
  6. One look in almost any club C64 disk
  7. library will reveal a multitude of
  8. picture disks. Many of the disks
  9. contain "BITMAPS". Bitmaps are
  10. monocolor (black and white) pictures
  11. 8000 bytes long (32 blocks on disk).
  12. Normally they take 30 seconds to load
  13. into memory.
  14.  
  15. In Volume 6, Issue 4 of the
  16. Transactor, Chris Zamara published a
  17. machine code program to shrink BASIC
  18. bitmap pictures by coding them. We
  19. took his idea and wrote a COMAL 0.14
  20. machine code routine that does this.
  21. Demonstration programs, sample
  22. pictures, and the machine code are on
  23. this Ahoy disk.
  24.  
  25. The idea of compression is simple.
  26. Much of any picture is blank space
  27. (all bytes on). To shrink the bitmap,
  28. the bytes are encoded. When three
  29. consecutive bytes or more are the
  30. same, we code them. First we send a
  31. byte 254 followed by the byte to
  32. repeat, and finally the number of
  33. bytes to show. For instance, 100
  34. consecutive bytes of zero's would be
  35. coded 254, 0, 100. This would save 97
  36. bytes. If a single byte 254 is
  37. encountered, we code 254, 254, 1.
  38. Random pictures will not shrink much,
  39. but most files are reduced by 40-80%
  40. (making them smaller and faster in
  41. loading).
  42.  
  43. This program allows you to convert
  44. BASIC or COMAL bitmaps to compacted
  45. bitmaps, view the compacted bitmaps,
  46. and update the two SEQ files needed
  47. by the programs. Make sure to update
  48. the directory file before trying to
  49. compact new bitmaps.
  50.  
  51. There are three COMAL 0.14 programs
  52. on this disk that work together to
  53. allow you to compact bitmaps, view
  54. compressed pictures, and maintain a
  55. database of the pictures on a given
  56. disk. The files " directory" and
  57. " compact pix" hold the names of the
  58. pictures on the disk.
  59.